package net.apexes.demo.codegen.dslite.qvar;

import net.apexes.demo.codegen.dslite.entity.Brand;
import net.apexes.demo.codegen.dslite.qvar.base.QEntityBase;
import net.wafo.dslite.core.info.Index;

import net.wafo.dslite.core.dsl.*;

/**
 * QBrand is a DSLite query type for Brand
 * @see Brand
 */
public class QBrand extends QEntityBase<Brand> {

    public static final QBrand $ = new QBrand("BRAND");

    public final StringColumn sn = varchar("SN", 16).field("sn").notNull().build();

    public final StringColumn name = varchar("NAME", 32).field("name").notNull().build();

    public class Indexs {

        public final Index constraintIndex3 = index("CONSTRAINT_INDEX_3").unique().column(sn).build();

        public final Index primaryKey3 = index("PRIMARY_KEY_3").unique().column(id).build();

    }

    public final Indexs ix = new Indexs();

    public QBrand(String tableName) {
        super(Brand.class, tableName);
    }

    @Override
    public Brand newEntity() {
        return new Brand();
    }

    @Override
    public Object getFieldValue(Brand entity, String fieldName) {
        switch (fieldName) {
            case "sn":
                return entity.getSn();
            case "name":
                return entity.getName();
            default:
                return super.getFieldValue(entity, fieldName);
        }
    }

    @Override
    public void setFieldValue(Brand entity, String fieldName, Object value) {
        switch (fieldName) {
            case "sn":
                entity.setSn((java.lang.String) value);
                break;
            case "name":
                entity.setName((java.lang.String) value);
                break;
            default:
                super.setFieldValue(entity, fieldName, value);
                break;
        }
    }

}

